﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DefaultSite.Master" AutoEventWireup="true" CodeBehind="VoluntaryActivityRequest.aspx.cs" Inherits="SocialIn.Web.MyPage.VoluntaryActivityRequest" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

<%@ Register Assembly="AjaxControlToolkit, Version=1.0.20229.20821, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" 
Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <p>
    <asp:Label ID="Label1" runat="server" Text="이벤트 내용"></asp:Label><br />
    <asp:TextBox ID="tbEvent" runat="server" Width="719px"></asp:TextBox><br />
    </p>
    <p>
    <asp:Label ID="Label7" runat="server" Text="재능카테고리"></asp:Label><br />
    <asp:RadioButtonList ID="rblTalent" runat="server" RepeatDirection="Horizontal" RepeatColumns="7"></asp:RadioButtonList><br />
    </p>
    <p>
    <asp:Label ID="Label2" runat="server" Text="인원"></asp:Label><br />
    <asp:TextBox ID="tbComplement" runat="server"></asp:TextBox><br />
    </p>
    <p>
    <asp:Label ID="Label3" runat="server" Text="봉사장소"></asp:Label><br />
    <asp:TextBox ID="tbLocation" runat="server" Width="689px"></asp:TextBox><br />
    <asp:Label ID="Label8" runat="server" Text="주소를 입력하여 검색하면 해당 지역으로 바로 이동합니다. (ex. 용산구 한남동)"></asp:Label>
    <input type="button" onclick="addrSearch();" title="검색" value="검색"/><br />
    </p>
     <div id="map" style="width:<%= Width %>px;height:<%= Height %>px;float:left;border:none;"></div>
   <div style="clear:both;border:none;">
       
       <%--<div id="roldmap" style="width:<%= Width %>px;height:<%= Height %>px;float:left;border:none;"></div>--%>
    </div> 

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <p>
            <asp:Label ID="Label4" runat="server" Text="날짜와 봉사 시간"></asp:Label><br />
            <cc1:CalendarExtender ID="calendarExt" runat="server" TargetControlID="tbDate"></cc1:CalendarExtender>
            <asp:TextBox ID="tbDate" runat="server"></asp:TextBox>
            <asp:DropDownList ID="ddlHour" runat="server">
        </asp:DropDownList>
        <asp:Label ID="Label9" runat="server" Text="시"></asp:Label>
        <asp:DropDownList ID="ddlMinute" runat="server">
        </asp:DropDownList>
        <asp:Label ID="Label5" runat="server" Text="부터"></asp:Label>
        <asp:DropDownList ID="ddlTimespan" runat="server"></asp:DropDownList>
        <asp:Label ID="Label6" runat="server" Text="시간"></asp:Label>
        </p>
        </ContentTemplate>
        
    </asp:UpdatePanel>

    <asp:Button ID="btnRegister" runat="server" Text="추가하기" 
        onclick="btnRegister_Click" />

    <script type="text/javascript" src="http://apis.daum.net/maps/maps2.js?apikey=<asp:Literal runat='server' Text='<%$appSettings:MapKey%>' />"></script> 

    <script type="text/javascript">
    var map = new DMap("map");
    var indexMapControl = new DIndexMapControl(); 
    var zoomControl = new DZoomControl(); 
    var mapTypeControl = new DMapTypeControl() 
    map.addControl(zoomControl); 
    map.addControl(mapTypeControl); 
    indexMapControl.setAlign("left"); 
    zoomControl.setVAlign("middle");

    var latlng = new DLatLng(<%= Position %>);
    var latlngwithlevel = new DLatLng(<%= Position %>, <%= Level %>);    
    map.setCenter(latlngwithlevel); 
    
    var m = new DMark(latlng);
    map.addOverlay(m);  
     
//    var opt = {point:latlng,width:<%= Width %>,height:<%= Height %>,pan:<%= Pan %>,tilt:<%= Tilt %>,zoom:<%= Level %>}; 
//    var rv = new DRoadView("roldmap",opt);
 
    DEvent.addListener(map, "move", function() {     
        var center = map.getCenter();    
        m.setPoint(center); 
    });
    
//    DEvent.addListener(rv,"move",function(point){
//        m.setPoint(point);
//        map.setCenter(point);        
//    });

    function addrSearch(){
	if ($("#<%=tbLocation.ClientID %>").val()) {
	  var s = document.createElement('script');
	  s.type ='text/javascript';
	  s.charset ='utf-8';
	  s.src = 'http://apis.daum.net/maps/addr2coord?apikey=' + '<asp:Literal runat="server" Text="<%$appSettings:MapKey%>" />' + '&output=json&callback=addrSearchResult&q=' + encodeURI($("#<%=tbLocation.ClientID %>").val());
	  document.getElementsByTagName('head')[0].appendChild(s);
	}
}

function addrSearchResult (z){
	var latlng;
	if(!z.channel || z.channel.item.length <= 0){
		alert("검색 결과가 없습니다.");
		return;
	}else	{
		latlng = new DLatLng(z.channel.item[0].point_y, z.channel.item[0].point_x);
		map.setCenter(latlng);
	}

    //z.channel.item[0].title : 주소
}

    </script>
</asp:Content>
